package model;

import java.util.ArrayList;
import java.util.List;

import javax.swing.AbstractListModel;
import javax.swing.ComboBoxModel;

import entidade.Situacao;

@SuppressWarnings({ "rawtypes", "serial" })
public class SituacaoComboBoxModel extends AbstractListModel implements
ComboBoxModel {
	 private Object selectedItem;
     private List<Situacao> list;

     public SituacaoComboBoxModel() {
             list = new ArrayList<Situacao>();
     }

     public SituacaoComboBoxModel(List<Situacao> lista) {
             this();
             list.addAll(lista);
     }

     @Override
     public int getSize() {
             return list.size();
     }

     @Override
     public Situacao getElementAt(int index) {
             Situacao s = list.get(index);
             return s;
     }

     @Override
     public void setSelectedItem(Object anItem) {
             selectedItem = anItem;
     }

     @Override
     public Object getSelectedItem() {
             return selectedItem;
     }

}
